package com.gmall.console.utils;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Path;
import java.nio.file.Paths;

/**
 * @description:
 * @author: Jone
 * @create: 2024-05-27
 */
public class Test {
    private static String URL = "jdbc:mysql:///mallData";
    private static String USER_NAME = "root";
    private static String PWD = "12345678";
    private static Path PATH = Paths.get(System.getProperty("user.dir"));


    public static void main(String[] args) {
        FastAutoGenerator.create(URL, USER_NAME, PWD)
                .globalConfig(builder -> builder
                        .author("Jone")
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.gmall.console")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok()
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
